<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Global args</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../process/reference.html#header.boost.process.args_hpp" title="Header &lt;boost/process/args.hpp&gt;">
<link rel="prev" href="../../process/reference.html" title="Reference">
<link rel="next" href="argv.html" title="Global argv">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../process/reference.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../process/reference.html#header.boost.process.args_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="argv.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.process.args"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Global args</span></h2>
<p>boost::process::args</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../process/reference.html#header.boost.process.args_hpp" title="Header &lt;boost/process/args.hpp&gt;">boost/process/args.hpp</a>&gt;

</span><span class="emphasis"><em><span class="identifier">unspecified</span></em></span> args<span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.31.9.2.4.4"></a><h2>Description</h2>
<p>The <code class="computeroutput">args</code> property allows to explicitly set arguments for the execution. The name of the executable will always be the first element in the arg-vector.</p>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="namespaceboost_1_1process_1args_details"></a>Details</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="sect2"><a href="args.html#namespaceboost_1_1process_1args_operations">Operations</a></span></dt>
<dt><span class="sect2"><a href="args.html#namespaceboost_1_1process_1args_example">Example</a></span></dt>
</dl></div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="namespaceboost_1_1process_1args_operations"></a>Operations</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="sect3"><a href="args.html#namespaceboost_1_1process_1args_set_var">Setting values</a></span></dt>
<dt><span class="sect3"><a href="args.html#namespaceboost_1_1process_1args_append_var">Appending values</a></span></dt>
</dl></div>
<div class="sect3">
<div class="titlepage"><div><div><h4 class="title">
<a name="namespaceboost_1_1process_1args_set_var"></a>Setting values</h4></div></div></div>
<div class="toc"><dl class="toc"><dt><span class="sect4"><a href="args.html#namespaceboost_1_1process_1args_set_var_value">value</a></span></dt></dl></div>
<p>To set a the argument vector the following syntax can be used.</p>
<pre class="programlisting"><span class="identifier">args</span> <span class="special">=</span> <span class="identifier">value</span><span class="special">;</span>
<span class="identifier">args</span><span class="special">(</span><span class="identifier">value</span><span class="special">)</span><span class="special">;</span>
</pre>
<p><code class="computeroutput">std::initializer_list</code> is among the allowed types, so the following syntax is also possible.</p>
<pre class="programlisting"><span class="identifier">args</span> <span class="special">=</span> <span class="special">{</span><span class="identifier">value1</span><span class="special">,</span> <span class="identifier">value2</span><span class="special">}</span><span class="special">;</span>
<span class="identifier">args</span><span class="special">(</span><span class="special">{</span><span class="identifier">value1</span><span class="special">,</span> <span class="identifier">value2</span><span class="special">}</span><span class="special">)</span><span class="special">;</span>
</pre>
<p>Below the possible types for <code class="computeroutput">value</code> are listed, with <code class="computeroutput">char_type</code> being either <code class="computeroutput">char</code> or <code class="computeroutput">wchar_t</code>.</p>
<div class="sect4">
<div class="titlepage"><div><div><h5 class="title">
<a name="namespaceboost_1_1process_1args_set_var_value"></a>value</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><code class="computeroutput">std::basic_string&lt;char_type&gt;</code></p></li>
<li class="listitem"><p><code class="computeroutput">const char_type *</code></p></li>
<li class="listitem"><p><code class="computeroutput">std::initializer_list&lt;const char_type *&gt;</code></p></li>
<li class="listitem"><p><code class="computeroutput">std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</code></p></li>
</ul></div>
<p>
</p>
<p>Additionally any range of <code class="computeroutput">std::basic_string&lt;char_type&gt;</code> can be passed.</p>
</div>
</div>
<div class="sect3">
<div class="titlepage"><div><div><h4 class="title">
<a name="namespaceboost_1_1process_1args_append_var"></a>Appending values</h4></div></div></div>
<div class="toc"><dl class="toc"><dt><span class="sect4"><a href="args.html#namespaceboost_1_1process_1args_append_var_value">value</a></span></dt></dl></div>
<p>To append a the argument vector the following syntax can be used.</p>
<pre class="programlisting"><span class="identifier">args</span> <span class="special">+=</span> <span class="identifier">value</span><span class="special">;</span>
</pre>
<p><code class="computeroutput">std::initializer_list</code> is among the allowed types, so the following syntax is also possible.</p>
<pre class="programlisting"><span class="identifier">args</span> <span class="special">+=</span> <span class="special">{</span><span class="identifier">value1</span><span class="special">,</span> <span class="identifier">value2</span><span class="special">}</span><span class="special">;</span>
</pre>
<p>Below the possible types for <code class="computeroutput">value</code> are listed, with <code class="computeroutput">char_type</code> being either <code class="computeroutput">char</code> or <code class="computeroutput">wchar_t</code>.</p>
<div class="sect4">
<div class="titlepage"><div><div><h5 class="title">
<a name="namespaceboost_1_1process_1args_append_var_value"></a>value</h5></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><code class="computeroutput">std::basic_string&lt;char_type&gt;</code></p></li>
<li class="listitem"><p><code class="computeroutput">const char_type *</code></p></li>
<li class="listitem"><p><code class="computeroutput">std::initializer_list&lt;const char_type *&gt;</code></p></li>
<li class="listitem"><p><code class="computeroutput">std::vector&lt;std::basic_string&lt;char_type&gt;&gt;</code></p></li>
</ul></div>
<p>
</p>
<p>Additionally any range of <code class="computeroutput">std::basic_string&lt;char_type&gt;</code> can be passed.</p>
</div>
</div>
</div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="namespaceboost_1_1process_1args_example"></a>Example</h3></div></div></div>
<p>The overload form is used when more than one string is passed, from the second one forward. I.e. the following expressions have the same results:</p>
<pre class="programlisting"><span class="identifier">spawn</span><span class="special">(</span><span class="string">"gcc"</span><span class="special">,</span> <span class="string">"--version"</span><span class="special">)</span><span class="special">;</span>
<span class="identifier">spawn</span><span class="special">(</span><span class="string">"gcc"</span><span class="special">,</span> <span class="identifier">args</span> <span class="special">=</span><span class="string">"--version"</span><span class="special">)</span><span class="special">;</span>
<span class="identifier">spawn</span><span class="special">(</span><span class="string">"gcc"</span><span class="special">,</span> <span class="identifier">args</span><span class="special">+=</span><span class="string">"--version"</span><span class="special">)</span><span class="special">;</span>
<span class="identifier">spawn</span><span class="special">(</span><span class="string">"gcc"</span><span class="special">,</span> <span class="identifier">args</span> <span class="special">=</span><span class="special">{</span><span class="string">"--version"</span><span class="special">}</span><span class="special">)</span><span class="special">;</span>
<span class="identifier">spawn</span><span class="special">(</span><span class="string">"gcc"</span><span class="special">,</span> <span class="identifier">args</span><span class="special">+=</span><span class="special">{</span><span class="string">"--version"</span><span class="special">}</span><span class="special">)</span><span class="special">;</span>
</pre>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>A string will be parsed and set in quotes if it has none and contains spaces. </p></td></tr>
</table></div>
<p>
</p>
</div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Julio M. Merino Vidal, Ilya Sokolov,
      Felipe Tanus, Jeff Flinn, Boris Schaeling<br>Copyright © 2016 Klemens D. Morgenstern<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../process/reference.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../process/reference.html#header.boost.process.args_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="argv.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
